<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
    
        let a = [12,78,56,42,6,100];

        // a.sort();
        // a.reverse();

        // console.log(a);

        a.sort(function(a, b) {
            // return a-b;    //升序
            return b-a;        //降序
        });
        console.log(a);
    
    </script>
</body>
</html>